import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from tabulate import tabulate
#Make some functions:
#Descriptive Statistics Table Maker:
def table(df):
statistics = df.describe(percentiles = [.25, .5, .75])
statistics = statistics.transpose()
columns = ['mean', '25%', '50%', '75%', 'std', 'min', 'max']
table = statistics[columns]
display(table)
return(table)
#Excel processing
def process(path, tab_name, row_to_skip, column_to_skip):
df = pd.read_excel(path, sheet_name=tab_name, skiprows=row_to_skip)
# Set the first row as column names and the first column as the index
df.columns = df.iloc[0]
df.index = df.iloc[:, 0]
# Store the index for later use
index = df.iloc[:, 0]
# Remove the first row and the first column, and reset the index
df = df.iloc[1:].reset_index(drop=True)
df = df.iloc[:, 1:]
# Set the index to the values from the stored index
df.index = index.values[1:]
df = df.iloc[:, :column_to_skip]
return df
def heatmap(table):
plt.figure(figsize=(10, 10))
mask = np.triu(np.ones_like(table.corr()))
heatmap = sns.heatmap(table.corr(), mask=mask, annot=True)
plt.show()
def plot_dataframe(df, title, x_label, y_label):
for column in df.columns:
plt.plot(df.index, df[column], label=column)
# Customize the plot
plt.title(title)
plt.xlabel(x_label)
plt.ylabel(y_label)
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
def descriptive_stats(group):
for i in group:
print("Variable: ", i)
names = ["mean", 'std', 'min', '25%', '50%', '75%', 'max']
values = [group[i].mean(), group[i].std(), group[i].min(), group[i].quantile(q=0.25), group[i].quantile(q=0.50), group[i].quantile(q=0.75), group[i].max()]
table = [names, values]
print(tabulate(table))
print("\n")
#Add the Macro data:
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\macro\CPIAUCSL.xls"
CPI = process(path, "FRED Graph", 9, 1)
CPI = CPI[860:]
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\macro\T10YIE.xls"
T10 = process(path, "FRED Graph", 9, 1)
T10 = T10[T10['T10YIE'] != 0]
T10 = T10[93:]
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\macro\UNRATE.xls"
UNRATE = process(path, "FRED Graph", 9, 1)
UNRATE = UNRATE[850:]
plt.figure(figsize=(18, 10))
plot_dataframe(CPI, "Consumer Price Index","MONTH","CPI")
plt.figure(figsize=(18, 10))
plot_dataframe(T10, "Ten Year Breakeven Inflation Point","MONTH","inflation point")
plt.figure(figsize=(18, 10))
plot_dataframe(UNRATE, "Unemployment Rate","MONTH","unemployment rate")
Ecomonic Indicators
Overall, these indicators are essential tools for understanding and managing economic conditions, making informed investment decisions, and formulating appropriate economic policies.
US TREASURY SECURITIES
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Treasury-Securities-Statistics-SIFMA.xlsx"
#Treasury Securities
#Clean/Extract the data
us_treasury = process(path, "Trading Volume", 7, 5)
us_treasury_trading_volume_monthly = us_treasury[25:]
plt.figure(figsize=(18, 10))
#Plot the time-series data for SIFMA for the time period that each series is available
plot_dataframe(us_treasury_trading_volume_monthly,"Monthly Trading Volume","MONTH","Amount in Billions")
#Coupon Securities
us_treasury = process(path, "Trading Volume", 7, 14)
us_treasury_trading_coupon = us_treasury.iloc[25:,6:]
plt.figure(figsize=(18, 10))
#Plot the time-series data for SIFMA for the time period that each series is available
plot_dataframe(us_treasury_trading_coupon,"Monthly Trading Volume of Coupon Securities","MONTH","Amount in Billions")
#TIPS
us_treasury = process(path, "Trading Volume", 7, 18)
us_treasury_trading_tips = us_treasury.iloc[25:,15:]
plt.figure(figsize=(18, 10))
#Plot the time-series data for SIFMA for the time period that each series is available
plot_dataframe(us_treasury_trading_tips,"Monthly Trading Volume of TIPS","MONTH","Amount in Billions")
descriptive_stats(us_treasury_trading_volume_monthly)
descriptive_stats(us_treasury_trading_coupon)
descriptive_stats(us_treasury_trading_tips)
treasury = pd.concat([us_treasury_trading_volume_monthly, us_treasury_trading_coupon, us_treasury_trading_tips])
sns.heatmap(treasury.corr())
Variable: Treasury Bills ------------------ ------------------ ------------------ ------------------ ------ ------------------ ----------------- mean std min 25% 50% 75% max 148.34719510085642 18.633445190527013 124.97619047619048 127.01428571428572 152.94 161.23333333333332 173.1478260869565 ------------------ ------------------ ------------------ ------------------ ------ ------------------ ----------------- Variable: Treasury Inflation Index Securities (TIPS) ------------------ ------------------ ------------------ ------------------ ------------------ ------ ------ mean std min 25% 50% 75% max 15.351622458395914 3.4205463264144242 11.157142857142858 13.513636363636364 14.585714285714289 17.685 21.725 ------------------ ------------------ ------------------ ------------------ ------------------ ------ ------ Variable: Floating Rate Notes (FRNs) ------------------ ------------------ --- ------------------ --- ------------------ ----------------- mean std min 25% 50% 75% max 3.7982232755802547 2.2558062068584066 1.3 2.1904761904761907 3.4 4.4526315789473685 9.294736842105262 ------------------ ------------------ --- ------------------ --- ------------------ ----------------- Variable: Coupon Securities ----------------- ----------------- ---------------- ------------------ ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 542.0776442893491 80.55315772002777 363.852380952381 497.89047619047614 538.3210526315789 588.2454545454545 676.8347826086957 ----------------- ----------------- ---------------- ------------------ ----------------- ----------------- ----------------- Variable: Total ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 709.5761435399078 97.70571955336267 502.9000000000001 665.9526315789474 695.5649999999999 774.2318181818181 875.2130434782609 ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- Variable: Coupon Securities Due =< 2Y ------------------ ------------------ ----------------- ----------------- ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 104.37153194631456 12.895127796852494 72.85238095238095 100.0578947368421 105.26190476190476 109.99565217391303 127.49565217391304 ------------------ ------------------ ----------------- ----------------- ------------------ ------------------ ------------------ Variable: Coupon Securities Due > 2Y but =< 3Y ----------------- ------------------ ----------------- ----------------- ------ ----------------- ------ mean std min 25% 50% 75% max 68.17931027782286 10.497545980932532 51.13333333333333 62.76190476190476 66.485 71.28947368421052 89.465 ----------------- ------------------ ----------------- ----------------- ------ ----------------- ------ Variable: Coupon Securities Due > 3Y but =<5Y ------------------ ----------------- ----------------- ------------------ ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 148.70690867103912 26.64045651136267 95.68095238095238 139.22105263157897 145.37142857142857 162.13333333333333 202.29130434782607 ------------------ ----------------- ----------------- ------------------ ------------------ ------------------ ------------------ Variable: Coupon Securities Due > 5Y but =< 7Y ------------------ ---------------- ------------------ ----------------- ------------------ ------------------ ----------------- mean std min 25% 50% 75% max 47.165837408205824 8.28019632611027 29.114285714285714 43.30952380952381 46.573684210526324 54.304545454545455 57.51304347826087 ------------------ ---------------- ------------------ ----------------- ------------------ ------------------ ----------------- Variable: Coupon Securities Due > 7Y but =< 10Y ----------------- ------------------ ----------------- ----------------- ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 107.5026973446081 16.551918587372395 69.07619047619048 98.86190476190475 106.18947368421054 118.41363636363636 129.66086956521738 ----------------- ------------------ ----------------- ----------------- ------------------ ------------------ ------------------ Variable: Coupon Securities Due > 10Y ---- --- --- --- --- --- --- mean std min 25% 50% 75% max 0.0 0.0 0 0.0 0.0 0.0 0 ---- --- --- --- --- --- --- Variable: Coupon Securities Due > 10Y but =< 20Y ------------------ ----------------- ------------------ ------------------ ------------------ ----- ------------------ mean std min 25% 50% 75% max 16.724578255459264 2.867781438830915 11.478947368421052 15.561904761904762 17.456521739130434 18.25 21.704347826086956 ------------------ ----------------- ------------------ ------------------ ------------------ ----- ------------------ Variable: Coupon Securities Due > 20Y ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 49.42913251889225 9.416315628844274 34.10952380952381 41.18095238095238 51.95652173913044 57.18421052631579 62.08695652173913 ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- Variable: TIPS Due =< 5Y ----------------- ------------------ ----------------- ----------------- ----------------- ----------------- ------------------ mean std min 25% 50% 75% max 9.244168219271195 2.2399402288963586 5.714285714285714 8.290909090909091 8.747826086956522 10.30952380952381 13.238095238095237 ----------------- ------------------ ----------------- ----------------- ----------------- ----------------- ------------------ Variable: TIPS Due in > 5Y but =< 10Y ---------------- ----------------- ------------------ ------------------ ----------------- ----------------- ----- mean std min 25% 50% 75% max 4.79829607844482 1.408442381969265 3.1523809523809527 3.9368421052631586 4.371428571428572 5.371428571428571 8.405 ---------------- ----------------- ------------------ ------------------ ----------------- ----------------- ----- Variable: TIPS Due > 10Y ------------------ ------------------- ------------------ ---- ------------------ ----------------- ------------------ mean std min 25% 50% 75% max 1.3115144999927608 0.33946227846915167 0.9210526315789473 1.06 1.2956521739130435 1.434782608695652 2.1428571428571423 ------------------ ------------------- ------------------ ---- ------------------ ----------------- ------------------
<Axes: xlabel='0', ylabel='0'>
US GCF REPO INDEX
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Repo-Statistics-SIFMA.xlsx"
#US REPO INDEX
us_repo_monthly_trading_volume = process(path, "Primary Dealer", 7, 3)
us_repo_monthly_trading_volume = us_repo_monthly_trading_volume[25:]
plt.figure(figsize=(18, 10))
#Plot the time-series data for SIFMA for the time period that each series is available
plot_dataframe(us_repo_monthly_trading_volume,"Repo Monthly Trading Volume","MONTH","Amount in Billions")
#Coupon Securities
us_repo_reverse = process(path, "Primary Dealer", 7, 7)
us_repo_reverse = us_repo_reverse.iloc[25:,4:]
plt.figure(figsize=(18, 10))
#Plot the time-series data for SIFMA for the time period that each series is available
plot_dataframe(us_repo_reverse,"Reverse Repo","MONTH","Amount in Billions")
repo = process(path, "Primary Dealer", 7,17)
repo_monthly_companies = repo.iloc[25:,10:]
plt.figure(figsize=(18, 10))
plot_dataframe(repo_monthly_companies,"COMPANIES Repo","MONTH","Amount in Billions")
repo_mbs = process(path, "Primary Dealer", 7,29)
repo_monthly_reverse = repo_mbs.iloc[25:,22:]
# repo_monthly
plt.figure(figsize=(18, 10))
plot_dataframe(repo_monthly_reverse,"Reverse Repo","MONTH","Amount in Billions")
repo = process(path, "Primary Dealer", 7,21)
repo_mbs = repo.iloc[25:,19:]
# repo_monthly
plt.figure(figsize=(18, 10))
plot_dataframe(repo_mbs,"Repo-MBS","MONTH","Amount in Billions")
reverse_repo = process(path, "Primary Dealer", 7,33)
rev_repo_mbs = reverse_repo.iloc[25:,31:]
# rev_repo_monthly
plt.figure(figsize=(18, 10))
plot_dataframe(rev_repo_mbs,"Reverse MBS Repo","MONTH","Amount in Bilions")
repo = pd.concat([us_repo_monthly_trading_volume, us_repo_reverse, repo_monthly_companies, repo_monthly_reverse, repo_mbs, rev_repo_mbs], axis=1)
sns.heatmap(repo.corr())
descriptive_stats(us_repo_monthly_trading_volume), descriptive_stats(us_repo_reverse)
Variable: Overnight ------------------ ----------------- ---------- ------------------ ---------- -------- -------- mean std min 25% 50% 75% max 2063.8129230769227 190.0971200696871 1808.82775 1906.5153999999998 2058.99575 2235.818 2329.245 ------------------ ----------------- ---------- ------------------ ---------- -------- -------- Variable: Term ----------------- ----------------- --------- -------- -------- -------- ----------------- mean std min 25% 50% 75% max 627.1311076923078 28.32695778666388 575.55475 608.7875 627.7986 633.8608 675.7515000000001 ----------------- ----------------- --------- -------- -------- -------- ----------------- Variable: Total ------------------ ------------------ -------- ------------------ ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 2690.9440307692307 186.46493600269233 2429.474 2537.3577999999998 2634.5505000000003 2838.3762500000003 2987.5815000000002 ------------------ ------------------ -------- ------------------ ------------------ ------------------ ------------------ Variable: Overnight ----------------- ----------------- ------------------ --------- ---------- --------- --------- mean std min 25% 50% 75% max 1210.190976923077 86.67809101223484 1053.7859999999998 1128.7324 1225.76525 1273.2182 1341.8086 ----------------- ----------------- ------------------ --------- ---------- --------- --------- Variable: Term ----------------- ----------------- ----------------- -------- --------- ------- -------- mean std min 25% 50% 75% max 907.9490346153846 53.17832181419725 835.3655000000001 872.3422 901.84175 941.415 1035.566 ----------------- ----------------- ----------------- -------- --------- ------- -------- Variable: Total ------------------ ----------------- --------- --------- ------------------ ---------- ------------------ mean std min 25% 50% 75% max 2118.1400115384613 121.2866071224756 1938.7205 2016.5834 2112.5232499999997 2201.28325 2322.1665000000003 ------------------ ----------------- --------- --------- ------------------ ---------- ------------------
(None, None)
US EQUITY ISSUANCE AND TRADING VOLUMES
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Equities-and-Related-Statistics-SIFMA.xlsx"
EOP = process(path, "Indexes & Volatility", 7,5)
EOP_monthly = EOP.iloc[25:]
plt.figure(figsize=(18, 10))
plot_dataframe(EOP_monthly,"END OF PERIOD INDEXES","MONTH","Amount")
eop_vix = process(path, "Indexes & Volatility", 7,6)
eop_vix = eop_vix.iloc[25:, 5:]
# eop_vix
plt.figure(figsize=(18, 10))
plot_dataframe(eop_vix,"END OF PERIOD VIX","MONTH","Amount")
ave = process(path, "Indexes & Volatility", 7,12)
ave_monthly = ave.iloc[25:,7:]
ave_monthly
plt.figure(figsize=(14, 8))
plot_dataframe(ave_monthly,"END OF PERIOD INDEXES","MONTH","Amount")
ave_vix = process(path, "Indexes & Volatility", 7,13)
ave_vix = ave_vix.iloc[25:, 12:]
# eop_vix
plt.figure(figsize=(14, 8))
plot_dataframe(ave_vix,"AVERAGE VIX","MONTH","Amount")
tape_volume = process(path, "ADV #", 7,3)
tape_volume_monthly = tape_volume.iloc[25:]
# tape_volume_monthly
plt.figure(figsize=(18, 10))
plot_dataframe(tape_volume_monthly,"Average Daily Trading Share - TAPE","MONTH","Amount")
equities = pd.concat([EOP_monthly, eop_vix, ave_monthly, ave_vix, tape_volume_monthly])
descriptive_stats(equities)
sns.heatmap(equities.corr())
Variable: DJIA ----------------- ------------------ -------- -------- -------- ------------------ -------- mean std min 25% 50% 75% max 33228.72884615385 1509.1045909951422 28725.51 32776.78 33450.11 34095.130000000005 35559.53 ----------------- ------------------ -------- -------- -------- ------------------ -------- Variable: S&P 500 ----------------- ------------------ ------- --------- -------- --------- ------- mean std min 25% 50% 75% max 4097.574230769231 255.38965354411798 3585.62 3926.8675 4079.895 4177.2425 4588.96 ----------------- ------------------ ------- --------- -------- --------- ------- Variable: Nasdaq ------------------ ------------------ -------- --------- --------- ------------------ -------- mean std min 25% 50% 75% max 12103.345384615388 1181.6238199705717 10466.48 11111.205 11800.635 12844.032500000001 14346.02 ------------------ ------------------ -------- --------- --------- ------------------ -------- Variable: Russell 2000 ------------------ ----------------- -------- ------------------ -------- ---------- -------- mean std min 25% 50% 75% max 1840.6481923076924 79.50916866124017 1664.716 1776.7115000000001 1845.489 1899.00475 2003.177 ------------------ ----------------- -------- ------------------ -------- ---------- -------- Variable: NYSE ------------------ ----------------- -------- ---------- ------------------ ---------- -------- mean std min 25% 50% 75% max 15342.600000000002 662.7680159030007 13472.18 15090.3125 15413.755000000001 15815.3825 16427.29 ------------------ ----------------- -------- ---------- ------------------ ---------- -------- Variable: VIX ------------------ ----------------- ----- ------ ----- ------ ----- mean std min 25% 50% 75% max 20.093076923076918 5.091771563200952 13.57 15.815 20.12 21.975 31.62 ------------------ ----------------- ----- ------ ----- ------ ----- Variable: Tape A ----------------- ------------------ ------------------ ------------------ ---------- ----------------- ----------------- mean std min 25% 50% 75% max 4167.115940710044 325.36901620447725 3726.4646992105263 3977.7235415500004 4108.88668 4359.974996761905 4882.348975173913 ----------------- ------------------ ------------------ ------------------ ---------- ----------------- ----------------- Variable: Tape B ------------------ ------------------ ------------- ------------------ ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 1947.0017884776157 228.84848443891593 1640.74999445 1763.1052220526317 1945.6924946842105 2043.6102381904761 2349.4100969565216 ------------------ ------------------ ------------- ------------------ ------------------ ------------------ ------------------ Variable: Tape C ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ------------ mean std min 25% 50% 75% max 4957.548582008002 246.6139603444129 4689.824014857142 4771.861056142858 4837.869992142858 5245.417413428571 5370.6602412 ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ------------
<Axes: xlabel='0', ylabel='0'>
Do you see any patterns in the time-series? Is there any seasonality?
US FIXED INCOME SECURITIES
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Fixed-Income-Securities-Statistics-SIFMA.xlsx"
trading_vol_fixed = process(path, "Trading Volume", 6, 8)
trading_vol_fixed_monthly = trading_vol_fixed.iloc[25:]
plt.figure(figsize=(18, 10))
plot_dataframe(trading_vol_fixed_monthly,"Fixed Income Trading Volumne","MONTH","Amount")
descriptive_stats(trading_vol_fixed_monthly)
sns.heatmap(trading_vol_fixed_monthly.corr())
Variable: UST ----------------- ------------------ ----------------- ----------------- ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 695.5023977205099 104.21594651375749 502.9000000000001 639.4190476190475 691.2565217391304 774.2318181818181 875.2130434782609 ----------------- ------------------ ----------------- ----------------- ----------------- ----------------- ----------------- Variable: Agency MBS ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- ------------ mean std min 25% 50% 75% max 237.3203247236577 16.449672691474973 198.10003704761905 230.66942711904755 239.54840403636362 245.3025820263158 263.84720799 ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- ------------ Variable: Non-Agency MBS ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- ------------------ mean std min 25% 50% 75% max 1.373116034940536 0.3790460899047805 1.0378969913043476 1.1671315136363638 1.2494920142857142 1.483317978947368 2.4139013649999996 ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- ------------------ Variable: Corporates ------------------ ---------------- ------------------ ------------------ ----------------- ------- ----------------- mean std min 25% 50% 75% max 38.976202348261964 4.85772928841071 30.786285714285718 36.651700000000005 38.51604761904762 39.9385 47.91905263157895 ------------------ ---------------- ------------------ ------------------ ----------------- ------- ----------------- Variable: Munis ------------------ ------------------ ------ ------ ------ ------ ------ mean std min 25% 50% 75% max 13.461000000000002 1.5718287650589253 11.334 12.054 13.133 15.032 15.882 ------------------ ------------------ ------ ------ ------ ------ ------ Variable: Agency ----------------- ------------------ ------- ----------------- ------------------ ------------------ ----------------- mean std min 25% 50% 75% max 3.167966855760562 0.8063862199063073 2.25865 2.490333333333333 3.1824761904761907 3.4757894736842103 4.550545454545454 ----------------- ------------------ ------- ----------------- ------------------ ------------------ ----------------- Variable: ABS ------------------ ------------------- ------------------ ------------------ ------------------ ------------------ ----------------- mean std min 25% 50% 75% max 1.6148484321709755 0.31924725008888366 1.0670910900000001 1.4531820315789472 1.6201566099999998 1.8327452052631577 2.094405247619047 ------------------ ------------------- ------------------ ------------------ ------------------ ------------------ ----------------- Variable: Total ----------------- ------------------ ----------------- ----------------- ----------------- ----------------- ------------------ mean std min 25% 50% 75% max 991.4158561153016 121.04320011510104 751.5207341333333 937.8724787571429 996.1191188947369 1071.877926059091 1187.9895073110674 ----------------- ------------------ ----------------- ----------------- ----------------- ----------------- ------------------
<Axes: xlabel='0', ylabel='0'>
Do you see any patterns in the time-series? Is there any seasonality?
Corporate Bonds
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Corporate-Bonds-Statistics-SIFMA.xlsx"
trading_vol = process(path, "Trading Volume", 7, 3)
trading_vol_public = trading_vol.iloc[25:]
plt.figure(figsize=(18, 10))
plot_dataframe(trading_vol_public,"Publicly Traded","YEAR","Amount in Billions")
trading_vol = process(path, "Trading Volume", 7, 7)
trading_vol_14A = trading_vol.iloc[25:, 4:]
plt.figure(figsize=(18, 10))
plot_dataframe(trading_vol_14A,"14A","YEAR","Amount in Billions")
trading_vol = process(path, "Trading Volume", 7, 11)
trading_vol_NonConvert = trading_vol.iloc[25:, 8:]
plt.figure(figsize=(18, 10))
plot_dataframe(trading_vol_NonConvert,"Total Nonconvertible","YEAR","Amount in Billions")
trading_vol = process(path, "Trading Volume", 7, 13)
trading_vol_convert = trading_vol.iloc[25:, 12:]
plt.figure(figsize=(18, 10))
plot_dataframe(trading_vol_convert,"Total Convertible","YEAR","Amount in Billions")
bonds = pd.concat([trading_vol_public, trading_vol_14A, trading_vol_NonConvert, trading_vol_convert], axis =1)
descriptive_stats(trading_vol_public)
sns.heatmap(bonds.corr())
Variable: Investment Grade ------------------ ------------------ ------ ----------------- ----------------- ----------------- ------------------ mean std min 25% 50% 75% max 23.705957477533907 2.7674781935462427 19.262 22.73278947368421 23.23633333333333 24.51440909090909 28.367736842105263 ------------------ ------------------ ------ ----------------- ----------------- ----------------- ------------------ Variable: High Yield ---------------- ------------------ ----------------- ----------------- ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 5.70585796979527 1.0654578739740075 3.872047619047619 5.197789473684211 5.486826086956522 6.307318181818182 7.950736842105264 ---------------- ------------------ ----------------- ----------------- ----------------- ----------------- ----------------- Variable: Total ------------------ ----------------- ----------------- ----------------- ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 29.411815447329175 3.736194562165449 23.13404761904762 27.93057894736842 28.797333333333334 30.821727272727273 36.318473684210524 ------------------ ----------------- ----------------- ----------------- ------------------ ------------------ ------------------
<Axes: xlabel='0', ylabel='0'>
US ASSET BACKED SECURITIES
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Asset-Backed-Securities-Statistics-SIFMA.xlsx"
abs_trading_volume = process(path, "ABS Trading Volume - $", 6,6)
abs_trading_volume = abs_trading_volume.iloc[25:,]
plt.figure(figsize=(18, 10))
plot_dataframe(abs_trading_volume.head(13),"VOLUME","YEAR","Amount in Millions")
descriptive_stats(abs_trading_volume)
sns.heatmap(abs_trading_volume.corr())
Variable: ABS ----------------- ---------------- -------- -------- ----------------- ----------- --------- mean std min 25% 50% 75% max 918.9811295923331 272.719812764323 506.3517 684.1238 933.5327478260868 1056.964025 1519.5542 ----------------- ---------------- -------- -------- ----------------- ----------- --------- Variable: CDO ----------------- ----------------- ------------------ ---------- ----------------- ------------------ --------- mean std min 25% 50% 75% max 830.4921834242049 310.7666296459455 295.78770000000003 625.155375 790.0063842105262 1003.3599321428572 1753.6299 ----------------- ----------------- ------------------ ---------- ----------------- ------------------ --------- Variable: Other ------------------- ------------------- --- --- --- --- ------------------ mean std min 25% 50% 75% max 0.03373015873015873 0.20238095238095236 0 0.0 0.0 0.0 1.2142857142857142 ------------------- ------------------- --- --- --- --- ------------------ Variable: Total ------------------ ----------------- -------- ----------------- ------------------ ----------- -------- mean std min 25% 50% 75% max 1749.5070431752672 485.1763945558023 882.8313 1368.765193478261 1790.0918749482403 2088.425425 2657.556 ------------------ ----------------- -------- ----------------- ------------------ ----------- -------- Variable: IG ------------------ ---------------- ----------------- ------------------ ------------------ ----------- --------- mean std min 25% 50% 75% max 1404.6772000002472 398.957099337268 783.7017000000001 1110.7044761904763 1355.3064050000003 1632.058125 2308.5338 ------------------ ---------------- ----------------- ------------------ ------------------ ----------- --------- Variable: HY ----------------- ------------------ ------- ---------- ----------------- ------------------ ----------------- mean std min 25% 50% 75% max 344.8298431750202 158.28425315617508 95.2312 226.962825 317.8383347826086 422.15451428571436 716.9507714285713 ----------------- ------------------ ------- ---------- ----------------- ------------------ -----------------
<Axes: xlabel='0', ylabel='0'>
Do you see any patterns in the time-series? Is there any seasonality?
US AGENCY DEBT
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Agency-Debt-Statistics-SIFMA.xlsx"
agency_trading_volume = process(path, "Trading Volume", 6, 5)
agency_trading_volume = agency_trading_volume.iloc[25:,]
plt.figure(figsize=(18, 10))
plot_dataframe(agency_trading_volume,"Trading Volume","YEAR","Amount in Billions")
descriptive_stats(agency_trading_volume)
sns.heatmap(agency_trading_volume.corr())
Variable: Fannie Mae ------------------- -------------------- ------------------- ------------------- ------------------- ------------------- ------------------ mean std min 25% 50% 75% max 0.21846673787692097 0.046190416951699224 0.12954545454545452 0.20410526315789473 0.22752380952380952 0.23613636363636362 0.2985217391304348 ------------------- -------------------- ------------------- ------------------- ------------------- ------------------- ------------------ Variable: FHLB ----------------- ------------------ ------------------ ------------------ ------ ------- ------------------ mean std min 25% 50% 75% max 1.467288512669634 0.7390423017156353 0.6292857142857143 1.0136190476190476 1.1036 1.63405 2.9731363636363635 ----------------- ------------------ ------------------ ------------------ ------ ------- ------------------ Variable: Freddie Mac ------------------ ------------------ ------------------- ------- ----------------- ------- ------- mean std min 25% 50% 75% max 1.0181430548856178 0.4461218131509146 0.34942105263157897 0.81265 0.931952380952381 1.25855 2.09485 ------------------ ------------------ ------------------- ------- ----------------- ------- ------- Variable: Other ------------------- ------------------ ------- ----- ------------------- ------------------ ------------------ mean std min 25% 50% 75% max 0.46406855032839006 0.3530731062921647 0.13135 0.165 0.20661904761904762 0.7974090909090908 0.9963809523809524 ------------------- ------------------ ------- ----- ------------------- ------------------ ------------------ Variable: Total ----------------- ------------------ ------- ----------------- ------------------ ------------------ ----------------- mean std min 25% 50% 75% max 3.167966855760562 0.8063862199063073 2.25865 2.490333333333333 3.1824761904761907 3.4757894736842103 4.550545454545454 ----------------- ------------------ ------- ----------------- ------------------ ------------------ -----------------
<Axes: xlabel='0', ylabel='0'>
Cross Market Correlation of Securities
securities = pd.concat([agency_trading_volume, us_treasury_trading_volume_monthly, trading_vol_fixed_monthly], axis = 1)
sns.heatmap(securities.corr())
<Axes: xlabel='0', ylabel='0'>
ISSUANCE STATISTICS
Treasury Issuance, OUtstanding, and Interest Rates
#US Marketable Treasury Issuance, Outstanding, and Interest Rates
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Treasury-Securities-Statistics-SIFMA.xlsx"
#Total Issuance
treasury_issuance = process(path, "Issuance Net", 7, 15)
treasury_issuance = treasury_issuance.iloc[25:,12:]
plt.figure(figsize=(18, 10))
plot_dataframe(treasury_issuance,"Treasury Issuance Total","Month","Amount in Billions")
treasury_outstanding = process(path, "Outstanding", 6, 6)
treasury_outstanding = treasury_outstanding.iloc[25:,]
plt.figure(figsize=(18, 10))
plot_dataframe(treasury_outstanding,"Treasury Outsanding","Month","Amount in Billions")
treasury_interest_rates = process(path, "Yield Curve Rates", 7, 3)
treasury_interest_rates = treasury_interest_rates.iloc[25:,]
plt.figure(figsize=(18, 10))
plot_dataframe(treasury_interest_rates,"Yiled Curve Rates","Month","Averages for the period")
descriptive_stats(treasury_issuance)
descriptive_stats(treasury_outstanding)
descriptive_stats(treasury_interest_rates)
treasury = pd.concat([treasury_issuance, treasury_outstanding, treasury_interest_rates], axis = 1)
sns.heatmap(treasury.corr())
Variable: Gross Issues ------------------ ----------------- ------------------ -------- -------- ------- -------- mean std min 25% 50% 75% max 1637.2791538461538 311.9681652804888 1202.3000000000002 1342.698 1628.992 1771.21 2316.938 ------------------ ----------------- ------------------ -------- -------- ------- -------- Variable: Gross Retirement ------------------ ------------------ -------- -------- ------------------ -------- -------- mean std min 25% 50% 75% max 1480.4852307692306 215.16502572876234 1267.659 1324.419 1428.1149999999998 1500.136 1983.702 ------------------ ------------------ -------- -------- ------------------ -------- -------- Variable: Net Cash Raised ------------------ ------------------ ------------------ ----------------- ------------------ ----------------- ----------------- mean std min 25% 50% 75% max 156.79392307692308 175.14458361139876 -106.4219999999999 33.20700000000008 160.50500000000017 246.3559999999998 549.9660000000001 ------------------ ------------------ ------------------ ----------------- ------------------ ----------------- ----------------- Variable: Bills ------------------ ----------------- ------------ ------------ ------------------ -------------- ------------ mean std min 25% 50% 75% max 4041.4033584799995 341.2441232588406 3665.9784493 3843.6472255 3968.0332946500002 4066.069294925 4770.5145957 ------------------ ----------------- ------------ ------------ ------------------ -------------- ------------ Variable: Notes -------------- ----------------- ------------------ -------------- -------------- -------------- ------------ mean std min 25% 50% 75% max 13737.48789827 17.79871492113009 13717.937353700001 13725.60748415 13733.15774545 13748.40087005 13774.295519 -------------- ----------------- ------------------ -------------- -------------- -------------- ------------ Variable: Bonds -------------- ------------------ ------------------ ------------- -------------- ------------ ------------------ mean std min 25% 50% 75% max 4049.953438315 100.10694514869078 3904.3402751500003 3970.37063155 4048.693886475 4126.0839034 4200.3508120999995 -------------- ------------------ ------------------ ------------- -------------- ------------ ------------------ Variable: TIPS ----------------- --------------- ---------------- ------------------ ----------------- ---------------- ------------------ mean std min 25% 50% 75% max 1892.367116866934 22.007550154117 1860.88587893899 1877.1783229244425 1891.836154422595 1905.43015793628 1933.6292502419699 ----------------- --------------- ---------------- ------------------ ----------------- ---------------- ------------------ Variable: FRN ----------------- ------------------ ----------------- ------------- ----------- ------------- ----------------- mean std min 25% 50% 75% max 580.3569862900001 26.079755577900407 527.5666633999999 566.575976425 582.8840241 599.858710725 617.2041916999999 ----------------- ------------------ ----------------- ------------- ----------- ------------- ----------------- Variable: Total ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- ----------------- mean std min 25% 50% 75% max 24301.56879822193 427.09623236442525 23738.638483888986 23992.180545090563 24279.333289968785 24363.41054446128 25132.50363145857 ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- ----------------- Variable: 3-Month Bills ----------------- ------------------ ----------------- ------------------ ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 4.590488927548424 0.8803739098520452 2.721739130434783 4.3229999999999995 4.787894736842103 5.308181818181819 5.559130434782609 ----------------- ------------------ ----------------- ------------------ ----------------- ----------------- ----------------- Variable: 10-Year Notes ----------------- ------------------- ------------------ ------------------ ------------------ ------------------ ----------------- mean std min 25% 50% 75% max 3.669077496492829 0.31013008786691804 2.8978260869565213 3.5315000000000003 3.6630434782608696 3.8909999999999996 4.167826086956523 ----------------- ------------------- ------------------ ------------------ ------------------ ------------------ ----------------- Variable: Spread ------------------- ------------------ ------------------- ------------------- ------------------- -------------------- ------------------- mean std min 25% 50% 75% max -0.9214114310555956 0.7379602407849437 -1.7345454545454548 -1.5889999999999995 -1.1559999999999997 -0.43199999999999994 0.29714285714285715 ------------------- ------------------ ------------------- ------------------- ------------------- -------------------- -------------------
<Axes: xlabel='0', ylabel='0'>
MBS Issuance and Outsanding
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Mortgage-Backed-Securities-Statistics-SIFMA.xlsx"
#Issuance
MBS_agency = process(path, "MBS Issuance", 17, 2)
MBS_agency = MBS_agency.iloc[49:,]
MBS_non_agency = process(path, "MBS Issuance", 17, 5)
MBS_non_agency = MBS_non_agency.iloc[49:, 3:]
MBS_MRS = process(path, "MBS Issuance", 17, 9)
MBS_MRS = MBS_MRS.iloc[49:, 6:]
MBS_issuance = pd.concat([MBS_agency, MBS_non_agency, MBS_MRS], axis=1)
plt.figure(figsize=(18, 10))
plot_dataframe(MBS_issuance,"MBS Issuance","Month","Amount in Billions")
#Outstanding
MBS_agency_OS = process(path, "MBS Outstanding", 16, 2)
MBS_agency_OS = MBS_agency_OS.iloc[20:,]
MBS_non_agency_OS = process(path, "MBS Outstanding", 16, 5)
MBS_non_agency_OS = MBS_non_agency_OS.iloc[20:, 3:]
MBS_total = process(path, "MBS Outstanding", 16, 9)
MBS_total = MBS_total.iloc[20:, 6:]
MBS_outstanding = pd.concat([MBS_agency_OS, MBS_non_agency_OS, MBS_total], axis =1 )
plt.figure(figsize=(18, 10))
plot_dataframe(MBS_outstanding,"MBS Outstanding","Month","Amount in Billions")
descriptive_stats(MBS_issuance)
descriptive_stats(MBS_outstanding)
MBS = pd.concat([MBS_issuance, MBS_outstanding], axis = 1)
sns.heatmap(MBS.corr())
Variable: MBS ----------------- ----------------- ------------------ ------------ -------------- --------------- ------------------ mean std min 25% 50% 75% max 275.0658559833637 75.19468413680605 150.63135977500002 195.99918314 287.3425302165 345.25162938375 384.69112549100004 ----------------- ----------------- ------------------ ------------ -------------- --------------- ------------------ Variable: CMO ----------------- ----------------- ------------ ------------------ ------------ -------------- ------------------ mean std min 25% 50% 75% max 37.11012680722729 8.741986039187386 24.615618023 30.794656976500004 37.470843284 41.83597430975 60.132218357000006 ----------------- ----------------- ------------ ------------------ ------------ -------------- ------------------ Variable: CMBS ----------------- ----------------- -------- -------- ----------------- --------- --------- mean std min 25% 50% 75% max 6.019945772727271 4.119433128183409 0.306414 3.476985 4.303221499999999 8.3621195 16.085979 ----------------- ----------------- -------- -------- ----------------- --------- --------- Variable: RMBS ------------------ ------------------ -------- ----------------- --------- ------------------ --------- mean std min 25% 50% 75% max 13.740011954545459 13.302883004055682 2.829632 4.995540500000001 9.6678605 15.882205500000001 57.913502 ------------------ ------------------ -------- ----------------- --------- ------------------ --------- Variable: Agency ------------------ ----------------- ------------------ --------------- -------------- ------------------ ------------- mean std min 25% 50% 75% max 312.17598279059087 81.46951466502284 178.45050472300002 225.25822262375 326.0807865845 387.47152918099994 420.069427183 ------------------ ----------------- ------------------ --------------- -------------- ------------------ ------------- Variable: Non-Agency ----------------- ------------------ ------------------ ----------------- ---------- ----------- --------- mean std min 25% 50% 75% max 19.75995772727273 14.387686260230364 3.1360460000000003 9.679806250000002 15.9661695 27.37888975 61.359347 ----------------- ------------------ ------------------ ----------------- ---------- ----------- --------- Variable: Total ----------------- ----------------- ------------------ ------------------ -------------- ------------------ ------------------ mean std min 25% 50% 75% max 331.9359405178637 85.86526761778086 196.00467972300004 250.16173567000004 334.8768530845 403.61171518099997 465.80257386999995 ----------------- ----------------- ------------------ ------------------ -------------- ------------------ ------------------ Variable: MBS ---------------- ----------------- ------ ------ ------ ------ -------- mean std min 25% 50% 75% max 7895.15288888889 475.3055464384053 7324.8 7514.3 7809.8 8181.4 8709.776 ---------------- ----------------- ------ ------ ------ ------ -------- Variable: CMO ------------------ ------------------ ------ ------ ------ ------------------ ------ mean std min 25% 50% 75% max 1228.3337869666668 137.86582062540757 1110.6 1111.5 1117.4 1374.8040827000002 1395.3 ------------------ ------------------ ------ ------ ------ ------------------ ------ Variable: CMBS ----------------- ----------------- -------- ------- ----------------- -------- ----------------- mean std min 25% 50% 75% max 582.7686288287373 22.05535928754759 547.0963 561.593 595.7968000000001 596.3996 602.0233000000001 ----------------- ----------------- -------- ------- ----------------- -------- ----------------- Variable: RMBS ----------------- ----------------- -------- ------- -------- -------- -------- mean std min 25% 50% 75% max 788.0963677395641 21.23248041333527 751.0353 781.309 783.7491 803.1273 820.0495 ----------------- ----------------- -------- ------- -------- -------- -------- Variable: Agency ----------------- ----------------- ------ ------ ------ ------ ------------- mean std min 25% 50% 75% max 9123.486675855554 600.3287561583282 8435.4 8626.6 8921.3 9559.6 10084.5800827 ----------------- ----------------- ------ ------ ------ ------ ------------- Variable: Non-Agency ------------------ ------------------ --------- --------- ------------------ --------- --------- mean std min 25% 50% 75% max 1370.8649965683014 16.461958530157435 1346.8321 1364.7203 1367.1711691147132 1380.1487 1401.5336 ------------------ ------------------ --------- --------- ------------------ --------- --------- Variable: Total ------------------ ----------------- --------- --------- ---------- ---------- ------------------ mean std min 25% 50% 75% max 10494.351672423858 600.9761265253999 9802.5458 9991.3203 10295.5445 10906.4321 11451.751251814714 ------------------ ----------------- --------- --------- ---------- ---------- ------------------
<Axes: xlabel='0', ylabel='0'>
Agency and MBS issuance follow the same pattern. The outstanding increases overall.
There doesn't appear to be a pattern related to the macro economic factors.
RMBS is negatively associated with the other MBS outstanding issuances.
ABS ISSUANCE & OUTSTANDING
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Asset-Backed-Securities-Statistics-SIFMA.xlsx"
#Issuance
ABS_issuance = process(path, "ABS Issuance", 9, 7)
ABS_issuance = ABS_issuance.iloc[25:,]
plt.figure(figsize=(18, 10))
plot_dataframe(ABS_issuance,"ABS Issuance","Month","Amount in Billions")
#Outstanding
ABS_outstanding = process(path, "ABS Outstanding", 13, 7)
ABS_outstanding = ABS_outstanding.iloc[38:,]
plt.figure(figsize=(18, 10))
plot_dataframe(ABS_outstanding,"ABS Outstanding","Month","Amount in Billions")
descriptive_stats(ABS_issuance)
descriptive_stats(ABS_outstanding)
ABS = pd.concat([ABS_outstanding, ABS_issuance], axis = 1)
sns.heatmap(ABS.corr())
Variable: Auto ------------------ ----------------- ----------------- -------- -------- --------- --------- mean std min 25% 50% 75% max 10260.394524769079 4184.672656184976 749.9780000000001 7935.316 10438.37 12901.009 17270.505 ------------------ ----------------- ----------------- -------- -------- --------- --------- Variable: CDO/CLO ------------------ ----------------- ----- ------- ------------------ -------- ------------------ mean std min 25% 50% 75% max 1549.4693173076923 938.6032305255599 500.5 880.576 1515.7000000000003 1965.464 4093.8019999999997 ------------------ ----------------- ----- ------- ------------------ -------- ------------------ Variable: Credit Cards ------------------ ------------------ --- ------- ------------------ ------------------ -------- mean std min 25% 50% 75% max 1719.3950206892307 1443.6092196992554 0 217.916 1899.8090000000002 2105.7700000000004 4296.149 ------------------ ------------------ --- ------- ------------------ ------------------ -------- Variable: Equipment ------------------ ------------------ ------- ----- -------- ------------------ -------- mean std min 25% 50% 75% max 1777.4029901358465 1118.7952650814216 150.321 850.0 1752.878 2379.1549999999997 4230.581 ------------------ ------------------ ------- ----- -------- ------------------ -------- Variable: Other ---------------- ---------------- -------- -------- -------- ----------------- --------- mean std min 25% 50% 75% max 4385.73556560623 2577.69966285496 2250.831 3030.562 3515.801 4829.179999999999 11639.919 ---------------- ---------------- -------- -------- -------- ----------------- --------- Variable: Student Loans ------------------ ------------------ --- --- --- ----------- ------- mean std min 25% 50% 75% max 230.13991125384615 286.29289076389034 0 0.0 0.0 567.8808463 717.192 ------------------ ------------------ --- --- --- ----------- ------- Variable: Total ------------------ ------------------ -------- ------------------ ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 19922.537329761926 5589.4454044827025 5043.275 18702.326999999997 20881.713999999996 23770.241286905002 26803.498999999996 ------------------ ------------------ -------- ------------------ ------------------ ------------------ ------------------ Variable: Automobile ------------------ ----------------- ------------------ ------------------ ------------------ ----------------- ------------------ mean std min 25% 50% 75% max 221.74933166087115 9.899505843931735 205.75166227689604 216.40263758531776 220.47796096595292 229.4523672028691 236.45433126992148 ------------------ ----------------- ------------------ ------------------ ------------------ ----------------- ------------------ Variable: Credit Card ---------------- ----------------- ----------------- ----------------- ----------------- ------------------ ------------------ mean std min 25% 50% 75% max 80.9797087252782 23.74913339390182 53.89912201331603 59.06653868119966 77.59494414861933 102.61386577404795 119.36591066197806 ---------------- ----------------- ----------------- ----------------- ----------------- ------------------ ------------------ Variable: Equipment ---------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 72.0092807579709 5.110924460085022 62.85453279413162 67.91153174365925 74.08711302460296 74.49447459076279 80.20064215588268 ---------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- Variable: Other ---------------- ------------------ ------------------ ------------------ ----------------- ----------------- ------------------ mean std min 25% 50% 75% max 226.640977080711 14.770439173961675 209.00125956136372 221.03026098557046 222.2311624838141 229.2797038012255 265.45723464214575 ---------------- ------------------ ------------------ ------------------ ----------------- ----------------- ------------------ Variable: Student Loans ------------------ --------------- ------------------ ------------------ ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 152.94934020822691 8.1118561499861 141.37581901080378 145.99426548381834 153.62142975940208 159.26743795973334 166.32837770085686 ------------------ --------------- ------------------ ------------------ ------------------ ------------------ ------------------ Variable: CDO/CLO ----------------- ------------------ ----------------- --------------- -------------- ----------------- ----------------- mean std min 25% 50% 75% max 806.7731523959842 31.385585408000058 754.8442242624084 791.36805529962 807.9834323046 828.7988801707309 859.1831716646078 ----------------- ------------------ ----------------- --------------- -------------- ----------------- ----------------- Variable: Total ------------------ ------------------ ------------------ ------------------ ---------------- ----------------- ------------------ mean std min 25% 50% 75% max 1561.1017908290423 51.462696462734556 1475.5833753669172 1530.2953573308398 1559.24984625271 1588.884313614794 1663.1961190365641 ------------------ ------------------ ------------------ ------------------ ---------------- ----------------- ------------------
<Axes: xlabel='0', ylabel='0'>
FIXED INCOME ISSUANCE & OUTSTANDING
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Fixed-Income-Securities-Statistics-SIFMA.xlsx"
#Issuance
fixed_issuance = process(path, "Issuance", 6, 7)
fixed_issuance = fixed_issuance.iloc[26:,]
plt.figure(figsize=(18, 10))
plot_dataframe(fixed_issuance,"Fixed Issuance","Month","Amount in Billions")
#Outstanding
fixed_outstanding = process(path, "Outstanding", 6, 8)
fixed_outstanding = fixed_outstanding.iloc[12:,]
plt.figure(figsize=(18, 10))
plot_dataframe(fixed_outstanding,"Fixed Outstanding","Month","Amount in Billions")
descriptive_stats(fixed_issuance)
descriptive_stats(fixed_outstanding)
fixed = pd.concat([fixed_issuance, fixed_outstanding], axis=1)
sns.heatmap(fixed.corr())
Variable: UST ------------------ ------------------ ------------------ ------------- ------------ ------------- ----------------- mean std min 25% 50% 75% max 302.78196441666665 124.51234403437519 116.75441869999999 262.000297725 265.00032085 347.925469875 531.8714828000001 ------------------ ------------------ ------------------ ------------- ------------ ------------- ----------------- Variable: MBS ------------------ ------------------ ------------ ------------- ------------- -------------- ------------------ mean std min 25% 50% 75% max 115.51905391941666 22.500385193671818 86.261279776 99.4752825645 113.752399434 124.7607253715 157.61898723100003 ------------------ ------------------ ------------ ------------- ------------- -------------- ------------------ Variable: Corporates ------------------ ----------------- ------------------ ----------------- -------- ---------- -------- mean std min 25% 50% 75% max 114.33003333333335 46.33864134407861 13.411999999999999 92.99647499999999 111.2308 132.821075 181.4165 ------------------ ----------------- ------------------ ----------------- -------- ---------- -------- Variable: Munis ------------------ ----------------- ------------------ ------------------ ------------------ ------- ------- mean std min 25% 50% 75% max 29.319091666666665 6.693330181804235 20.123199999999997 25.637100000000004 27.990650000000002 33.3985 41.7301 ------------------ ----------------- ------------------ ------------------ ------------------ ------- ------- Variable: Agency ------------------ ----------------- --------- ----------- --------- ------------------ --------- mean std min 25% 50% 75% max 111.61536333333333 60.01884547742587 53.223965 74.11392375 100.03921 119.14523874999999 268.34616 ------------------ ----------------- --------- ----------- --------- ------------------ --------- Variable: ABS ------------------ ----------------- ------------------ ---------- ---------- --------- ------------------ mean std min 25% 50% 75% max 19.601895333333335 5.711744184620559 5.0432749999999995 18.1998545 20.2375355 22.200997 26.803498999999995 ------------------ ----------------- ------------------ ---------- ---------- --------- ------------------ Variable: Total ----------------- ------------------ ------------ --------------- ----------------- ------------- -------------- mean std min 25% 50% 75% max 693.1674020027499 188.61275883407333 355.55877728 612.96483273675 677.4537293994999 804.476946148 1014.553359231 ----------------- ------------------ ------------ --------------- ----------------- ------------- -------------- Variable: UST ------------------ ----------------- --------- --------- ----------------- ----------------- ----------------- mean std min 25% 50% 75% max 23295.411859811575 1073.589091626232 21732.973 22584.039 23306.73509207125 23934.45280527553 24881.15746614197 ------------------ ----------------- --------- --------- ----------------- ----------------- ----------------- Variable: MBS ------------------ ------------------ ------------------ ------------------ ------------------ ------------------ ----------------- mean std min 25% 50% 75% max 11926.049472081484 265.89181935904526 11671.039213308586 11788.260116631065 11905.481019953544 12053.554601467931 12201.62818298232 ------------------ ------------------ ------------------ ------------------ ------------------ ------------------ ----------------- Variable: Corporates ------------ ----------------- --------- ---------- ------------------ ------------------ ------------------ mean std min 25% 50% 75% max 10131.413125 114.2818946533244 10011.796 10054.2965 10099.383999999998 10174.585500000001 10358.618999999999 ------------ ----------------- --------- ---------- ------------------ ------------------ ------------------ Variable: Munis ------------------ ------------------ ------- --------- ------------------ ---------- -------- mean std min 25% 50% 75% max 4044.1421250000003 19.074616434544605 4015.56 4034.1825 4046.8140000000003 4056.86575 4069.432 ------------------ ------------------ ------- --------- ------------------ ---------- -------- Variable: Agency ----------------- ----------------- ----------- ------------------ ----------- ----------- ----------- mean std min 25% 50% 75% max 1729.161201777778 309.2418582559171 1433.292829 1466.8459440000001 1619.225243 1935.749527 2257.040729 ----------------- ----------------- ----------- ------------------ ----------- ----------- ----------- Variable: ABS ---------------- ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- mean std min 25% 50% 75% max 1525.17328900103 55.58148135072386 1475.5833753669172 1495.1340177523327 1514.6846601377483 1549.9682458180866 1585.251831498425 ---------------- ----------------- ------------------ ------------------ ------------------ ------------------ ----------------- Variable: MMs ------------------ ------------------ ------------ ------------- ------------------ ------------ ------------ mean std min 25% 50% 75% max 1105.0251099322222 43.879421915727505 1014.1696392 1085.40111239 1121.3795476999999 1128.3443019 1166.1017535 ------------------ ------------------ ------------ ------------- ------------------ ------------ ------------ Variable: Total ----------------- ----------------- ------------------ ------------------ ------------------ ---------------- ----------------- mean std min 25% 50% 75% max 52132.96692217918 719.6096566942415 51578.757634836344 51726.330141928396 51873.902649020456 52410.0715658506 52946.24048268075 ----------------- ----------------- ------------------ ------------------ ------------------ ---------------- -----------------
<Axes: xlabel='0', ylabel='0'>
US ABCP & CP Outstanding
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\ABCP and OP.xls"
#Issuance
paper_outstanding = process(path, "CP Outstanding", 2, 5)
paper_outstanding = paper_outstanding.iloc[25:,]
plt.figure(figsize=(18, 10))
plot_dataframe(paper_outstanding,"Commercial Paper Outstanding","Month","Amount in Billions")
descriptive_stats(paper_outstanding)
sns.heatmap(paper_outstanding.corr())
Variable: Non-Financial ------------------ ------------------ --------- ------------ ----------- ------------ --------- mean std min 25% 50% 75% max 223.11836644081646 63.990540299670755 92.899368 174.49379366 226.1481895 274.71558705 347.49606 ------------------ ------------------ --------- ------------ ----------- ------------ --------- Variable: Financial ----------------- ----------------- ------------- ------------------ ------------- ------------ ------------- mean std min 25% 50% 75% max 551.7777289340193 96.46621378536781 409.288579877 498.20518843300005 524.905803442 562.21009502 850.809960306 ----------------- ----------------- ------------- ------------------ ------------- ------------ ------------- Variable: ABCP ------------------ ----------------- ---------- ------------ ------------ ------------- ------------ mean std min 25% 50% 75% max 369.30349115797475 204.6936592133436 223.594487 243.78553525 263.09429755 397.438735415 1189.4634866 ------------------ ----------------- ---------- ------------ ------------ ------------- ------------ Variable: Other ------------------- ------------------- --- --- --- --- --------- mean std min 25% 50% 75% max 0.07217620506329113 0.40622656129680923 0 0.0 0.0 0.0 3.6294701 ------------------- ------------------- --- --- --- --- --------- Variable: Total ------------------ ----------------- ------------- ------------------ --------------- --------------- -------------- mean std min 25% 50% 75% max 1144.2717627378731 266.9932289063738 884.870209877 1006.2110876842501 1050.5643060855 1120.3176276325 2160.725459285 ------------------ ----------------- ------------- ------------------ --------------- --------------- --------------
<Axes: xlabel='0', ylabel='0'>
US MUNICIPAL ISSUANCE
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Municipal-Bonds-Statistics-SIFMA.xlsx"
municipal_bond_type = process(path, "Issuance Total", 8, 2)
municipal_bond_type = municipal_bond_type.iloc[42:,]
municipal_bond_type.columns = ["GO", "Revenue"]
municipal_bid_type = process(path, "Issuance Total", 8, 6)
municipal_bid_type = municipal_bid_type.iloc[42:, 3: ]
municipal_bid_type.columns = ["Competitive", "Negotiated", "Private Placement"]
municipal_capital = process(path, "Issuance Total", 8, 9)
municipal_capital = municipal_capital.iloc[42:, 7:]
municipal_capital.columns = ["New Capital", "Refunding"]
municipal_total = process(path, "Issuance Total", 8, 11)
municipal_total = municipal_total.iloc[42:, 10:]
municipal_total.columns = ["Total"]
municipal_issuance = pd.concat([municipal_bond_type, municipal_bid_type, municipal_capital, municipal_total], axis = 1)
plt.figure(figsize=(18, 10))
plot_dataframe(municipal_issuance,"Municipal Issuance","Month","Amount in Billions")
sns.heatmap(municipal_issuance.corr())
<Axes: >
Corporate Issuance
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\sifma\US-Corporate-Bonds-Statistics-SIFMA.xlsx"
corporate_issuance_3 = process(path, "Issuance", 7, 3)
corporate_issuance_3 = corporate_issuance_3.iloc[25:,]
corporate_issuance_5 = process(path, "Issuance", 7, 6)
corporate_issuance_5 = corporate_issuance_5.iloc[25:, 4:]
corporate_issuance_8 = process(path, "Issuance", 7, 9)
corporate_issuance_8 = corporate_issuance_8.iloc[25:, 7:]
corporate_issuance = pd.concat([corporate_issuance_3, corporate_issuance_5, corporate_issuance_8], axis = 1)
plt.figure(figsize=(18, 10))
plot_dataframe(corporate_issuance,"Corporate Bond Issuance","Month","Amount in Billions")
descriptive_stats(corporate_issuance)
sns.heatmap(corporate_issuance.corr())
Variable: Investment Grade ----------------- ----------------- ------------------ ------- ------------------ ------------------ --------- mean std min 25% 50% 75% max 99.26772846153844 40.98405887104214 10.623899999999999 82.9061 100.98734999999999 107.63749999999999 159.62528 ----------------- ----------------- ------------------ ------- ------------------ ------------------ --------- Variable: High Yield ------------------ ----------------- ------ ----------------- ------------------ ------------------ -------- mean std min 25% 50% 75% max 11.439316153846153 6.673691399385024 2.2321 6.726109999999999 10.464870000000001 15.157950000000001 21.82498 ------------------ ----------------- ------ ----------------- ------------------ ------------------ -------- Variable: Total ------------------ ------------------ ------------------ ------- -------- -------- --------- mean std min 25% 50% 75% max 110.70704461538459 45.630712608477424 12.855999999999998 90.8836 107.9476 118.0804 181.33989 ------------------ ------------------ ------------------ ------- -------- -------- --------- Variable: Callable ----------------- ------------------ ------ ------- ------- ------------------ --------- mean std min 25% 50% 75% max 97.17755615384614 42.415898938335715 9.9315 75.8803 96.4189 104.38380000000001 177.33718 ----------------- ------------------ ------ ------- ------- ------------------ --------- Variable: Non-Callable ----------------- ----------------- -------- -------- ------- ------ ------- mean std min 25% 50% 75% max 6.132448846153846 5.448054444156568 1.030271 1.690039 5.00798 7.7414 16.7314 ----------------- ----------------- -------- -------- ------- ------ ------- Variable: Fixed Rate ----------------- ----------------- ----------------- ------ ----------------- -------- ---------- mean std min 25% 50% 75% max 86.47021884615387 42.19876075645729 8.405999999999999 60.723 82.94860000000001 105.9304 162.767451 ----------------- ----------------- ----------------- ------ ----------------- -------- ---------- Variable: Floating Rate ------------------ ----------------- ------ -------- ------- ----- ------------------ mean std min 25% 50% 75% max 16.839786153846152 9.872238132632793 3.5495 10.52873 15.5641 23.85 31.932810000000003 ------------------ ----------------- ------ -------- ------- ----- ------------------
<Axes: xlabel='0', ylabel='0'>
Discussion of the issuance and outstanding for each market against the trading volume in that market (of comparable markets)
Treasury
Fixed Income
Corporate Bond
Top 10 Token Analysis
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\xrp-usd-max.xls"
xrp = pd.read_csv(path)
xrp['snapped_at'] = pd.to_datetime(xrp['snapped_at'], utc=True)
xrp.set_index('snapped_at', inplace = True)
plot_dataframe(xrp[['total_volume']], "XRP", "Date", "Val")
plot_dataframe(xrp[['price']], "Price Data", "Date", "Price")
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\usdt-usd-max.xls"
usdt = pd.read_csv(path)
usdt['snapped_at'] = pd.to_datetime(usdt['snapped_at'], utc=True)
usdt.set_index('snapped_at', inplace = True)
plot_dataframe(usdt[['total_volume']], "USDT", "Date", "Val")
plot_dataframe(usdt[['price']], "Price Data", "Date", "Price")
USDT is the ticker symbol for Tether (USDT), one of the most well-known and widely used stablecoins in the cryptocurrency market. Stablecoins are a type of cryptocurrency that aims to maintain a stable value by pegging their price to a reserve of assets, often a fiat currency like the US Dollar (USD). In the case of USDT, it is designed to maintain a 1:1 value ratio with the US Dollar.
Total volume has decreased as CPI and inflation have increased
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\trx-usd-max.xls"
trx = pd.read_csv(path)
trx['snapped_at'] = pd.to_datetime(trx['snapped_at'], utc=True)
trx.set_index('snapped_at', inplace = True)
plot_dataframe(trx[['total_volume']], "TRX", "Date", "Val")
plot_dataframe(trx[['price']], "Price Data", "Date", "Price")
TRX is the ticker symbol for Tron (TRX), a blockchain-based cryptocurrency and platform designed for decentralized applications (DApps) and digital content sharing.
The price follows a similar path as the volume, but has increased in 2023 as CPI and inflation have increased.
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\steth-usd-max.xls"
steth = pd.read_csv(path)
steth['snapped_at'] = pd.to_datetime(steth['snapped_at'], utc=True)
steth.set_index('snapped_at', inplace = True)
plot_dataframe(steth[['total_volume']], "STETH", "Date", "Val")
plot_dataframe(steth[['price']], "Price Data", "Date", "Price")
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\sol-usd-max.xls"
sol = pd.read_csv(path)
sol['snapped_at'] = pd.to_datetime(sol['snapped_at'], utc=True)
sol.set_index('snapped_at', inplace = True)
plot_dataframe(sol[['total_volume']], "SOL", "Date", "Val")
plot_dataframe(sol[['price']], "SOL Price Data", "Date", "Price")
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\eth-usd-max.xls"
eth = pd.read_csv(path)
eth['snapped_at'] = pd.to_datetime(eth['snapped_at'], utc=True)
eth.set_index('snapped_at', inplace = True)
plot_dataframe(eth[['total_volume']], "ETH", "Date", "Val")
plot_dataframe(eth[['price']], "ETH Price Data", "Date", "Price")
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\doge-usd-max.xls"
doge = pd.read_csv(path)
doge['snapped_at'] = pd.to_datetime(doge['snapped_at'], utc=True)
doge.set_index('snapped_at', inplace = True)
plot_dataframe(doge[['total_volume']], "Doge", "Date", "Val")
plot_dataframe(doge[['price']], "Doge Price Data", "Date", "Price")
DOGE refers to Dogecoin, which is a cryptocurrency that started as a joke but has gained significant popularity and a dedicated community since its creation in December 2013.
The price of doge spiked in 2021 along with the total volume, and has since steadily fallen.
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\btc-usd-max.xls"
btc = pd.read_csv(path)
btc['snapped_at'] = pd.to_datetime(btc['snapped_at'], utc=True)
btc.set_index('snapped_at', inplace = True)
plot_dataframe(btc[['total_volume']], "BTC", "Date", "Val")
plot_dataframe(btc[['price']], "BTC Price Data", "Date", "Price")
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\bnb-usd-max.xls"
bnb = pd.read_csv(path)
bnb['snapped_at'] = pd.to_datetime(bnb['snapped_at'], utc=True)
bnb.set_index('snapped_at', inplace = True)
plot_dataframe(bnb[['total_volume']], "BNB", "Date", "Val")
plot_dataframe(bnb[['price']], "BNB Price Data", "Date", "Price")
path = r"C:\Users\mhlad\OneDrive\Desktop\Georgia Tech\Chava\Homework 2\crypto\ada-usd-max.xls"
ada = pd.read_csv(path)
ada['snapped_at'] = pd.to_datetime(ada['snapped_at'], utc=True)
ada.set_index('snapped_at', inplace = True)
plot_dataframe(ada[['total_volume']], "ADA", "Date", "Val")
plot_dataframe(ada[['price']], "ADA Price Data", "Date", "Price")
Interestingly, overall, the prices of the tokens have jumped in 2021. This could be due to a number of reasons, including increased adoption, institutional invesment, and Low Interest rates. As interest rates have increased, the prices have lowered.
Overall Analysis There appears to be a recurring pattern within the fixed income sector, showing distinct seasonality. In the early part of the year, especially during tax season, we observe a surge in the short-term borrowing needs in the United States. This phenomenon is likely tied to increased demand for Treasury Securities, resulting in a boost in their supply. Consequently, this surplus of supply tends to push yields higher, rendering them more enticing compared to holding cash.
As we approach the end of the year, typically around September and October, there is a noticeable shift in investment preferences towards equities. This shift can be attributed to the portfolio rebalancing that occurs as investors transition their assets from fixed income to equities, possibly in preparation for the coming year. The key insight for the cryptocurrency market is that it remains susceptible to broader market dynamics. Despite assertions from its proponents suggesting otherwise, the crypto market is not immune to the influence of macroeconomic indicators.